(1) Field of the Invention
The present invention relates to a relay unit and a frame tracing method that relay frames between a sending terminal and a receiving terminal belonging to different networks and are suitable for use in a network relay unit for managing the history of the process of relaying such transmission-reception of frames.
(2) Description of the Related Art
FIG. 13 is a block diagram for explaining an example of how a general relay unit is used. A relay unit (network relay unit) 100 shown in the diagram relays the transmission-reception of a frame (packet) between a plurality-of networks (in FIG. 13, three networks A to C). The relay unit 100 is respectively connected to the networks A to C through I/O interfaces 101a to 101c such that a frame can be transmitted and received between the networks A to C.
For instance, when a frame is transmitted from a sending terminal belonging to the network A through the relay unit 100 to a receiving terminal belonging to the network B, the relay unit 100 receives the frame transmitted from the network A, through the I/O interface 101a and then judges a receiving end, for example, from information recorded on the header portion of the frame and then transmits the frame to the receiving end of the network B through the I/O interface 101b. 
In such a relay unit, tracing the history of the frame relaying operation is performed as a countermeasure at the time of a fault occurrence, for example.
FIG. 14 is a block diagram showing the construction of the aforementioned relay unit 100 in further detail. As shown in the diagram, the relay unit 100 is constituted by a CPU 102, I/O interfaces 101a to 101c, a bus 103, and a random access memory (RAM) 104. With this arrangement, the relay unit 100 relays the transmission-reception of a frame between a plurality of networks A to C.
The I/O interfaces (hereinafter referred to as simply interfaces) 101a to 101c are respectively connected to the networks A to C, as previously described, and are also connected to the CPU 102 and the RAM 104 through the bus 103, whereby a frame can be delivered between the relay unit 100 and each of the networks A to C.
The RAM 104 stores various kinds of data or the like. This RAM 104 ensures both an area for a transmitting-receiving buffer 104b that temporarily stores a frame received from a sending terminal and an area for a trace buffer 104a that stores the whole or part of the frame stored in the transmitting-receiving buffer 104b. 
The bus 103 interconnects the interfaces 101a to 101c, the CPU 102, and the RAM 104, as previously described, and delivers various kinds of data or the like.
In the relay unit 100, the CPU 102 controls operation of the interfaces 101a to 101c, the RAM 104 and the like, thereby executing the frame relaying process and the frame tracing process as described infra.
FIG. 15 is a diagram for explaining a conventional frame tracing method in the relay unit 100 shown in FIG. 14. As shown in FIG. 15, the relay unit 100 temporarily stores a received frame in the transmitting-receiving buffer 104b and then copies the whole or part of the frame stored in the transmitting-receiving buffer 104b to the trace buffer 104a. 
For example, when data is transmitted from a terminal A1 of the network A to a terminal B1 of the network B through the relay unit 100 by the aforementioned construction, in the relay unit 100 the frame transmitted from the terminal A1 is received by the interface 101a as shown in FIG. 14, and this frame is temporarily stored in the transmitting-receiving buffer 104b of the RAM 104 through the bus 103, as shown by a dotted arrow a in FIG. 14.
Also, in the relay unit 100, either the whole frame stored in the transmitting-receiving buffer 104b or a portion of the frame including its header portion is copied in sequence to the trace buffer 104a of the RAM 104.
And the CPU 102 refers, for example, to information about the protocol header included in the header portion of the frame stored in the transmitting-receiving buffer 104b and then recognizes, based on the address or the like of the receiving end (terminal B1), that a network to which the terminal B1 belongs is the network B. After recognition, the CPU 102 transmits the frame from the transmitting-receiving buffer 104b through the bus 103 to the interface 101b connected to the network B, as shown by a dotted arrow b in FIG. 14. The interface 101b receiving the frame from the transmitting-receiving buffer 104b transmits the frame to the network B.
In addition, for example, in the case where the transmission of a frame has been completed or where the frame is abandoned by reasons such that no receiving end is found, the CPU 102 releases an area where the frame was stored, from the transmitting-receiving buffer 104.
In this manner, in the relay unit 100, the transmission-reception of a frame is relayed between a plurality of networks and also the whole or part of the relayed frame is stored in the trace buffer 104a as data to be traced (trace data). Trace data is thus stored in the trace buffer 104a, whereby the history of the relaying operation in the relay unit 100 can be managed.
And the trace data, which was stored in the trace buffer 104a, is traced and analyzed. With this, which I/O operation (relaying operation) has been performed can be known. Therefore, the trace data becomes important information, for example, when a fault is checked or when debugging is performed. Particularly, in the case where the relay unit 100 is operated with firmware, for example, it becomes important information.
However, in the conventional frame tracing method in the aforementioned relay unit 100, in the RAM 104 the whole or part of the frame stored in the transmitting-receiving buffer 104b is copied in sequence to the trace buffer 104a, but generally the speed of accessing (reading and writing) memory is considerably slower compared with the command executing time in the CPU 102 and therefore in the RAM 102 the process of copying data from the transmitting-receiving buffer 104b to the trace buffer 104a takes substantial time. For this reason, there is also a possibility that the copying process will increase the overhead time in the CPU 102 and constitute a hindrance to the relaying operation.
On the other hand, in Japanese Laid-Open Patent Publication No. HEI 4-135348, in a LAN controller a method is disclosed which directly writes the head portion of a frame including its header to a trace buffer and also writes the remaining portion excluding the head portion to a transmitting-receiving buffer, in order to eliminate copying a frame between memories and enhance the processing speed.
However, this method has to provide a dedicated trace buffer or previously ensure an area for a trace buffer onto memory. When a dedicated trace buffer is provided, an increase in the manufacturing cost will be incurred. Also, when an area for a trace buffer is previously ensured on memory, an area on the memory cannot be effectively utilized.
Furthermore, when the method disclosed in the aforementioned publication is applied to the relay unit in which a frame received from a sending source, as it is, is transmitted to a receiving terminal, the received frame has to be divided into two parts and stored in different buffers. Subsequently, the two parts must be read out from the different buffers and again transmitted as a single frame. That is, the aforementioned method requires both the process of dividing a frame when it is received and the process of reconstituting the divided parts when they are transmitted, so that there is also a problem that the process will become complicated.
The present invention has been made in view of the aforementioned problems. Accordingly, it is an object of the present invention to provide a relay unit and a frame tracing method in the same unit which are capable of performing the process of tracing a frame at high speeds, without providing a dedicated storage area for storing trace information and incurring complexity of the process, by contriving how to utilize a transmitting-receiving buffer.
To achieve the foregoing object and in accordance with one important aspect of the present invention, there is provided a relay unit for relaying frames between a sending source and a receiving end by transmitting the frames from a transmitting-receiving buffer to the receiving end after the frames received from the sending source have temporarily been stored in the transmitting-receiving buffer, the trace unit comprising: a management table in which storage positions of the frames in the transmitting-receiving buffer are managed in order of storage; and a control section for controlling both the storage of each frame in the transmitting-receiving buffer and release of a storage area for each frame from the transmitting-receiving buffer by referring to the management table; wherein the control section causes the transmitting-receiving buffer to hold the frames and also releases a storage area, in which the oldest frame among the frames is stored, from the transmitting-receiving buffer, each time a new frame is stored in the transmitting-receiving buffer after the number of the frames in the transmitting-receiving buffer has reached a predetermined number.
According to another important aspect of the present invention, in the relay unit for relaying frames between a sending source and a receiving end by transmitting the frames from a transmitting-receiving buffer to the receiving end after the frames received from the sending source have temporarily been stored in the transmitting-receiving buffer, there is provided a method of tracing the frames to obtain a history of the relaying operation, comprising the steps of: holding the frames in the transmitting-receiving buffer, while storage positions of the frames in the transmitting-receiving buffer are being managed in order of storage; and releasing a storage area for the frame oldest among the frames from the transmitting-receiving buffer, each time a new frame is stored in the transmitting-receiving buffer after the number of the frames in the transmitting-receiving buffer has reached a predetermined number.
Therefore, according to the relay unit and the frame tracing method of the present invention, a predetermined number of frames, including the newest frame, are always stored in order of storage in the transmitting-receiving buffer. For tracing, the header portion or the like of the frame 500 does not need to be copied or moved to a dedicated area. Besides, processing such as dividing and reconstituting of frames is also unnecessary. The process of tracing frames can be performed at high speeds without incurring an increase in the overhead time of the CPU and process complexity. Furthermore, since there is no need to provide a dedicated memory or area, there is no possibility that an increase in the manufacturing cost will be incurred and there is an advantage that can effectively utilize the area of memory or like in the relay unit.
Note that the management table may include (1) a frame management table in which a storage position of each frame is registered, the frame management table being provided for each frame; and (2) a trace management table in which a position of the frame management table corresponding to the oldest frame and a position of the frame management table corresponding to the newest frame are registered as a head-frame pointer and a last-frame pointer, respectively. In each frame management table, a position of the frame management table corresponding to a frame stored next to a corresponding frame in the transmitting-receiving buffer may be registered as a next-frame pointer. With this, there is an advantage that can manage the frames stored in the transmitting-receiving buffer, in order of storage with reliability.
Also, the control section may release the storage area for the oldest frame from the transmitting-receiving buffer, by rewriting the head-frame pointer in the trace management table such that the head-frame pointer indicates the position of the frame management table corresponding to the frame stored next to the oldest frame. With this, the storage area for the oldest frame can be released from the transmitting-receiving buffer at high speeds, whereby there is an advantage that can ensure a storage area for storing the newest frame.
In addition, the number of the frames and the predetermined number in the transmitting-receiving buffer may be registered in the trace management table, and the control section may discriminate whether or not the number of the frames in the transmitting-receiving buffer has reached the predetermined number, by referring to the trace management table. With this, each time a new frame is stored in the transmitting-receiving butter after the number of frames in the transmitting-receiving butter has reached a predetermined number, the storage area for the oldest frame can be released from the transmitting-receiving butter, so that there is an advantage that can efficiently use the transmitting-receiving butter.
Moreover, a predetermined area for each frame in the transmitting-receiving buffer may be copied to a retention medium in order of storage and archived as trace information. With this, there is an advantage that can easily archive trace information at high speeds.
Furthermore, only a predetermined area for each frame in the transmitting-receiving buffer may be held in the transmitting-receiving buffer and a storage area for each frame excluding the predetermined area may be released from the transmitting-receiving buffer. With this, the storage area in the transmitting-receiving buffer for tracing the frame can be reduced, so that there is an advantage that can enhance the efficiency of using the transmitting-receiving buffer.
Note that the relay unit of the present invention may further include a specification section for specifying the predetermined area to be held in the transmitting-receiving buffer. With this, there is an advantage that can arbitrary set a predetermined area to be held in the transmitting-receiving buffer.